//
//  FQHomeImageController.swift
//  SwiftProject
//
//  Created by 董駸 on 2023/4/7.
//

import UIKit

class FQHomeImageController: BaseListSectionController {
    var model : FQHomeImageModel! {
        didSet {
            switch model.type {
            case 0:
                inset = UIEdgeInsets(top: 4, left: 0, bottom: 0, right: 0)
            case 1:
                inset = UIEdgeInsets(top: 14, left: 0, bottom: 0, right: 0)
            default:
                inset = UIEdgeInsets(top: 18, left: 0, bottom: 20, right: 0)
            }
        }
    }
    
    override func sizeForItem(at index: Int) -> CGSize {
        switch model.type {
        case 0:
            return CGSize(width: SCREEN_WIDTH, height: 249~)
        case 1:
            return CGSize(width: SCREEN_WIDTH, height: 220~)
        default:
            return CGSize(width: SCREEN_WIDTH, height: 34~)
        }
    }
    
    override func cellForItem(at index: Int) -> UICollectionViewCell {
        let cell = dequeueReusableCell(cellType: FQHomeImageCollectionViewCell.self, index: index)
        cell.model = model
        return cell
    }
    
    override func didSelectItem(at index: Int) {
      
    }
    
    override func didUpdate(to object: Any) {
        model = object as? FQHomeImageModel
    }
}
